package com.xijia.wuyouwallet.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.xijia.wuyouwallet.R;
import com.xijia.wuyouwallet.base.BaseActivity;

/**
 * Created by Administrator on 2017/7/12 0012.
 */

public class TestActivity extends BaseActivity {

    private WebView webView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        webView = (WebView) findViewById(R.id.test_wv);
        WebSettings settings = webView.getSettings();
        //让webview对象支持解析alert()等特殊的javascript语句
        settings.setJavaScriptEnabled(true);
        webView.setWebChromeClient(new WebChromeClient());
        webView.addJavascriptInterface(this, "AndroidMessage");
        webView.loadUrl("http://fy.xijiakeji.com/");

    }



    @JavascriptInterface
    public String getMsg() {
        return "form java";
    }

}
